package com.liuyjy.base.es.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * @Author liuyjy
 * @Date 2022/3/22 14:11
 * @Description: 配置文件
 **/
@Configuration
public class EsConfig {

    @Autowired
    private Environment env;

    /**
     * localhost:9300 写在配置文件中就可以了
     */
/*    @Bean
    @ConditionalOnProperty(name="common.setting.elasticsearch.host")
    RestHighLevelClient elasticsearchClient() {
        ClientConfiguration configuration = ClientConfiguration.builder()
                .connectedTo("localhost:9300")
                //.withConnectTimeout(Duration.ofSeconds(5))
                //.withSocketTimeout(Duration.ofSeconds(3))
                //.useSsl()
                //.withDefaultHeaders(defaultHeaders)
                //.withBasicAuth(username, password)
                // ... other options
                .build();
        RestHighLevelClient client = RestClients.create(configuration).rest();
        return client;
    }*/
}
